//
//  ViewController.m
//  CTPopMenuDemo
//
//  Created by LYPC on 2017/8/29.
//  Copyright © 2017年 cattsoft. All rights reserved.
//

#import "ViewController.h"
#import "CTPopMenuManager.h"
#import "CTPopMenuModel.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
#pragma mark 点击上排按钮
// 纯文字menu
- (IBAction)topStyle1:(UIButton *)sender {
    NSMutableArray *tempArr = [NSMutableArray array];
    for (int i = 0; i < 5; i++) {
        CTPopMenuModel *model = [[CTPopMenuModel alloc] init];
        model.title = @"这里是标题";
        model.imageName = @"imageName";
        [tempArr addObject:model];
    }
    // 修改菜单样式
    CTPopMenuStyle *menuStyle = [[CTPopMenuStyle alloc] init];
    menuStyle.titleColor = [UIColor redColor];
    menuStyle.maskedColor = [UIColor greenColor];
    [CTPopMenuManager sharedManager].menuStyle = menuStyle;
    [CTPopMenuManager showPopMenuWithView:sender itemWidth:120 itemHeight:40 items:tempArr action:^(NSInteger row) {
        NSLog(@"点击了：%@", [tempArr[row] title]);
    } dismissAutomatically:YES];
}

// 带图
- (IBAction)topStyle2:(UIButton *)sender {
    NSMutableArray *tempArr = [NSMutableArray array];
    for (int i = 0; i < 5; i++) {
        CTPopMenuModel *model = [[CTPopMenuModel alloc] init];
        model.title = @"贵州GDP";
        model.imageName = @"imgIcon";
        [tempArr addObject:model];
    }
    CTPopMenuStyle *menuStyle = [[CTPopMenuStyle alloc] init];
    menuStyle.titleColor = [UIColor orangeColor];
    menuStyle.maskedColor = [UIColor purpleColor];
    [CTPopMenuManager sharedManager].menuStyle = menuStyle;
    [CTPopMenuManager showPopMenuWithView:sender itemWidth:120 itemHeight:40 items:tempArr action:^(NSInteger row) {
        NSLog(@"点击了：%@", [tempArr[row] title]);
    } dismissAutomatically:YES];
}

- (IBAction)topStyle3:(UIButton *)sender {
    NSMutableArray *tempArr = [NSMutableArray array];
    for (int i = 0; i < 5; i++) {
        CTPopMenuModel *model = [[CTPopMenuModel alloc] init];
        model.title = @"贵州GDP";
        model.imageName = @"imgIcon";
        [tempArr addObject:model];
    }
    CTPopMenuStyle *menuStyle = [[CTPopMenuStyle alloc] init];
    menuStyle.menuColor = [UIColor blackColor];
    menuStyle.maskedColor = [UIColor clearColor];
    menuStyle.titleColor = [UIColor whiteColor];
    [CTPopMenuManager sharedManager].menuStyle = menuStyle;
    [CTPopMenuManager showPopMenuWithView:sender itemWidth:120 itemHeight:40 items:tempArr action:^(NSInteger row) {
        NSLog(@"点击了：%@", [tempArr[row] title]);
    } dismissAutomatically:YES];
}

- (IBAction)topStyle4:(UIButton *)sender {
    NSMutableArray *tempArr = [NSMutableArray array];
    for (int i = 0; i < 5; i++) {
        CTPopMenuModel *model = [[CTPopMenuModel alloc] init];
        model.title = @"贵州GDP";
        model.imageName = @"imgIcon";
        [tempArr addObject:model];
    }
    [CTPopMenuManager showPopMenuWithView:sender itemWidth:120 itemHeight:40 items:tempArr action:^(NSInteger row) {
        NSLog(@"点击了：%@", [tempArr[row] title]);
    } dismissAutomatically:YES];
}

- (IBAction)topStyle5:(UIButton *)sender {
    NSMutableArray *tempArr = [NSMutableArray array];
    for (int i = 0; i < 5; i++) {
        CTPopMenuModel *model = [[CTPopMenuModel alloc] init];
        model.title = @"贵州GDP";
        model.imageName = @"imgIcon";
        [tempArr addObject:model];
    }
    [CTPopMenuManager showPopMenuWithView:sender itemWidth:120 itemHeight:30 items:tempArr action:^(NSInteger row) {
        NSLog(@"点击了：%@", [tempArr[row] title]);
    } dismissAutomatically:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
